<?php
namespace Todo\Model\Msg;

use Todo\Model\BaseModel;

class ContentModel extends BaseModel
{
    public $tableName = 'msg_content';

    public $_validate = array(
        array('title', 'require', '请输入消息标题'),
        array('title','1,50','标题长度超出限制！',1,'length'),
        array('sender', 'require', '消息发送者不能为空'),
        array('send_time', 'require', '消息发送时间不能为空'),
        array('type', 'require', '消息类型不能为空'),
        array('receiver', 'require', '消息接收者不能为空')
    );

    protected $_auto = array(
        array('create_time', '_timestamp', self::MODEL_BOTH, 'callback'),
        array('tnt_id', 'auto_tnt', self::MODEL_INSERT, 'function')
    );

    protected function _timestamp(){
        return date('Y-m-d H:i:s');
    }
}